﻿$(document).ready(function () {
    notification_on_load();
    setInterval(function(){notification_on_load()}, 5000);
})
function notification_on_load() {
    var xhttp;
    xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("notification-ground").innerHTML = this.responseText;
            if ($("#notification_count").text() != "0") {
                $("#notification_count_view").text($("#notification_count").text());
                $("#notification_count_view").show();
            }
            else
                $("#notification_count_view").hide();
        }
    };
    xhttp.open("GET", "../Ajax/ASP/Notification/notification_panel.aspx", true);
    xhttp.send();
}
function ShowNotificationModal(notificationID) {
    $("#notification_modal").show();

    var xhttp;
    xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("notification_content").innerHTML = this.responseText;
        }
    };
    xhttp.open("GET", "../Ajax/ASP/Notification/notification_modal_content.aspx?notificationID="+notificationID, true);
    xhttp.send();
}

function notification_modal_exit() {
    $('#notification_modal').fadeOut(50);
    notification_on_load();
}